#ifndef SINGLEAPPLICATION_H
#define SINGLEAPPLICATION_H

#include <QApplication>
#include <QTranslator>
#include <QDebug>
#include <QQuickView>
#include <QSharedMemory>
#include <QQuickStyle>
#include <QSettings>
#include "src/Manager/AppManager/MEngine.h"

class SingleApplication : public QApplication
{
    Q_OBJECT
public:
    SingleApplication(int &argc, char *argv[], const QString uniqueKey);

    bool sendMessage(const QString &message);

    void _initCommon(void);

    int  _loadQMLFile();

    QQmlContext *getRootContext();
    QObject *getRootObject(void);


public:
    bool isRunning();

    void _initStyle();
signals:

private:
    void _initEngineOrViewer(bool data);



public slots:
    void checkForMessage();
    void log();


private:
    bool _isRunning;
    bool isViewer;
    QSharedMemory sharedMemory;

private:
    MEngine * pEngine;
    QQmlComponent *component;
    QQuickView *viewer;
    QSettings settings;
};


#endif // SINGLEAPPLICATION_H
